<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ page import = "java.util.Calendar,java.io.InputStream,java.util.jar.Attributes,java.util.jar.Manifest" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!-- 最上方的頁面 -->
<%
    Calendar today = Calendar.getInstance();
    int year = today.get(Calendar.YEAR);
    int month = today.get(Calendar.MONTH) + 1;
    int date = today.get(Calendar.DAY_OF_MONTH);
    int day = today.get(Calendar.DAY_OF_WEEK) - 1;
    
    InputStream inputStream = application.getResourceAsStream("/META-INF/MANIFEST.MF");
    String buildInfo = "更新時間:";
    if (inputStream != null) {
        Manifest manifest = new Manifest(inputStream);
        Attributes attributes = manifest.getMainAttributes();
        //String buildTimestamp = attributes.getValue("Build-Timestamp");
        String buildTimestamp = attributes.getValue("Build-Time");
        buildInfo += buildTimestamp;
    } else {
        buildInfo = "沒有MANIFEST.MF檔案 !!";
    }
%>

    <script type="text/javascript">
        var gServerDate = new Object();
        gServerDate.year = <%=year%>;
        gServerDate.month = <%=month%>;
        gServerDate.date = <%=date%>;
        gServerDate.day = <%=day%>;
    </script>  
      
    <div id="headerBase">
      <!-- 檔頭背景 -->
      <div id="headerBg"></div>
      <!-- 使用者資訊 -->
      <div class="userProfile">
        <ul>
          <!-- 登入的使用者資訊 -->
          <li id="headerUserInfo"></li>
          <!-- 日期資訊 -->
          <li id="headerToday"></li>
        </ul>
      </div>
      
      <%-- 版本資訊 --%>
      <div style="position: absolute; top: 40px; left: 80%;
                  width: 180px; font-size: 13px;
                  font-weight: bold;
                  color: white">
          <font color="#0404B4"><%=buildInfo%></font>
      </div>
      <%-- 版本資訊 --%>
      
      <!-- 環境資訊 -->
      <div id="headerEnv" class="envFormalProfile"></div>
    </div>
    <!-- 檔頭收合開關(打開檔頭按鈕) -->
    <div id="btnHeaderOut" class="btnHeaderOut" style="display:none;"></div>
    <!-- 檔頭收合開關(收合檔頭按鈕) -->
    <div id="btnHeaderIn" class="btnHeaderIn"></div>